import 'package:flutter/material.dart';

import 'package:ft_reader/pages/details/chapter_page.dart';

// 目录
class CatalogPage extends StatefulWidget {
  final int bookId;

  final callBack;

  CatalogPage(this.bookId, {this.callBack});

  @override
  _CatalogPageState createState() => _CatalogPageState();
}

class _CatalogPageState extends State<CatalogPage>
  with AutomaticKeepAliveClientMixin {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        backgroundColor: widget.callBack == null
          ? Theme.of(context).primaryColor
          : Colors.white,
        elevation: 0,
        brightness: Brightness.light,
        iconTheme: IconThemeData(color: Colors.white),
        centerTitle: true,
        title: Text(
          '目录',
          style: TextStyle(
            color: widget.callBack == null
                ? Colors.white
                : Theme.of(context).primaryColor
          ),
        ),
      ),
      body: ChapterPage(widget.bookId, widget.callBack),
    );
  }

  @override
  // TODO: implement wantKeepAlive
  bool get wantKeepAlive => true;

}